home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / AppleTalk.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  47KB  |  1,253 lines

  1. /*
  2.      File:        AppleTalk.h
  3.  
  4.      Contains:    AppleTalk Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __APPLETALK__
  19. #define __APPLETALK__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __OSUTILS__
  25. #include <OSUtils.h>
  26. #endif
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. #if PRAGMA_IMPORT_SUPPORTED
  33. #pragma import on
  34. #endif
  35.  
  36. #if PRAGMA_ALIGN_SUPPORTED
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  41. /*
  42.     Real definition of EntityName is 3 PACKED strings of any length (32 is just an example). No
  43.     offests for Asm since each String address must be calculated by adding length byte to last string ptr.
  44.     In Pascal, String(32) will be 34 bytes long since fields never start on an odd byte unless they are 
  45.     only a byte long. So this will generate correct looking interfaces for Pascal and C, but they will not
  46.     be the same, which is OK since they are not used. 
  47. */
  48. struct EntityName {
  49.     Str32Field                         objStr;
  50.     Str32Field                         typeStr;
  51.     Str32Field                         zoneStr;
  52. };
  53. typedef struct EntityName EntityName;
  54.  
  55. typedef EntityName *EntityPtr;
  56. struct AddrBlock {
  57.     UInt16                             aNet;
  58.     UInt8                             aNode;
  59.     UInt8                             aSocket;
  60. };
  61. typedef struct AddrBlock AddrBlock;
  62.  
  63. #endif
  64. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  65.  
  66. enum {
  67.                                                                 /* Driver unit and reference numbers (ADSP is dynamic) */
  68.     mppUnitNum                    = 9,                            /* MPP unit number */
  69.     atpUnitNum                    = 10,                            /* ATP unit number */
  70.     xppUnitNum                    = 40,                            /* XPP unit number */
  71.     mppRefNum                    = -10,                            /* MPP reference number */
  72.     atpRefNum                    = -11,                            /* ATP reference number */
  73.     xppRefNum                    = -41,                            /* XPP reference number */
  74.                                                                 /* .MPP csCodes */
  75.     lookupReply                    = 242,                            /* This command queued to ourself */
  76.     writeLAP                    = 243,                            /* Write out LAP packet */
  77.     detachPH                    = 244,                            /* Detach LAP protocol handler */
  78.     attachPH                    = 245,                            /* Attach LAP protocol handler */
  79.     writeDDP                    = 246,                            /* Write out DDP packet */
  80.     closeSkt                    = 247,                            /* Close DDP socket */
  81.     openSkt                        = 248,                            /* Open DDP socket */
  82.     loadNBP                        = 249,                            /* Load NBP command-executing code */
  83.     lastResident                = 249,                            /* Last resident command */
  84.     confirmName                    = 250,                            /* Confirm name */
  85.     lookupName                    = 251,                            /* Look up name on internet */
  86.     removeName                    = 252,                            /* Remove name from Names Table */
  87.     registerName                = 253,                            /* Register name in Names Table */
  88.     killNBP                        = 254                            /* Kill outstanding NBP request */
  89. };
  90.  
  91.  
  92. enum {
  93.     unloadNBP                    = 255,                            /* Unload NBP command code */
  94.     setSelfSend                    = 256,                            /* MPP: Set to allow writes to self */
  95.     SetMyZone                    = 257,                            /* Set my zone name */
  96.     GetATalkInfo                = 258,                            /* get AppleTalk information */
  97.     ATalkClosePrep                = 259,                            /* AppleTalk close query */
  98.                                                                 /* .ATP csCodes */
  99.     nSendRequest                = 248,                            /* NSendRequest code */
  100.     relRspCB                    = 249,                            /* Release RspCB */
  101.     closeATPSkt                    = 250,                            /* Close ATP socket */
  102.     addResponse                    = 251,                            /* Add response code | Require open skt */
  103.     sendResponse                = 252,                            /* Send response code */
  104.     getRequest                    = 253,                            /* Get request code */
  105.     openATPSkt                    = 254,                            /* Open ATP socket */
  106.     sendRequest                    = 255,                            /* Send request code */
  107.     relTCB                        = 256,                            /* Release TCB */
  108.     killGetReq                    = 257,                            /* Kill GetRequest */
  109.     killSendReq                    = 258,                            /* Kill SendRequest */
  110.     killAllGetReq                = 259,                            /* Kill all getRequests for a skt */
  111.                                                                 /* .XPP csCodes */
  112.     openSess                    = 255,                            /* Open session */
  113.     closeSess                    = 254,                            /* Close session */
  114.     userCommand                    = 253                            /* User command */
  115. };
  116.  
  117.  
  118. enum {
  119.     userWrite                    = 252,                            /* User write */
  120.     getStatus                    = 251,                            /* Get status */
  121.     afpCall                        = 250,                            /* AFP command (buffer has command code) */
  122.     getParms                    = 249,                            /* Get parameters */
  123.     abortOS                        = 248,                            /* Abort open session request */
  124.     closeAll                    = 247,                            /* Close all open sessions */
  125.     xCall                        = 246,                            /* .XPP extended calls */
  126.                                                                 /* Transition Queue transition types */
  127.     ATTransOpen                    = 0,                            /*AppleTalk has opened*/
  128.     ATTransClose                = 2,                            /*AppleTalk is about to close*/
  129.     ATTransClosePrep            = 3,                            /*Is it OK to close AppleTalk ?*/
  130.     ATTransCancelClose            = 4,                            /*Cancel the ClosePrep transition*/
  131.     afpByteRangeLock            = 1,                            /*AFPCall command codes*/
  132.     afpVolClose                    = 2,                            /*AFPCall command codes*/
  133.     afpDirClose                    = 3,                            /*AFPCall command codes*/
  134.     afpForkClose                = 4,                            /*AFPCall command codes*/
  135.     afpCopyFile                    = 5,                            /*AFPCall command codes*/
  136.     afpDirCreate                = 6,                            /*AFPCall command codes*/
  137.     afpFileCreate                = 7,                            /*AFPCall command codes*/
  138.     afpDelete                    = 8,                            /*AFPCall command codes*/
  139.     afpEnumerate                = 9                                /*AFPCall command codes*/
  140. };
  141.  
  142.  
  143. enum {
  144.     afpFlush                    = 10,                            /*AFPCall command codes*/
  145.     afpForkFlush                = 11,                            /*AFPCall command codes*/
  146.     afpGetDirParms                = 12,                            /*AFPCall command codes*/
  147.     afpGetFileParms                = 13,                            /*AFPCall command codes*/
  148.     afpGetForkParms                = 14,                            /*AFPCall command codes*/
  149.     afpGetSInfo                    = 15,                            /*AFPCall command codes*/
  150.     afpGetSParms                = 16,                            /*AFPCall command codes*/
  151.     afpGetVolParms                = 17,                            /*AFPCall command codes*/
  152.     afpLogin                    = 18,                            /*AFPCall command codes*/
  153.     afpContLogin                = 19,                            /*AFPCall command codes*/
  154.     afpLogout                    = 20,                            /*AFPCall command codes*/
  155.     afpMapID                    = 21,                            /*AFPCall command codes*/
  156.     afpMapName                    = 22,                            /*AFPCall command codes*/
  157.     afpMove                        = 23,                            /*AFPCall command codes*/
  158.     afpOpenVol                    = 24,                            /*AFPCall command codes*/
  159.     afpOpenDir                    = 25,                            /*AFPCall command codes*/
  160.     afpOpenFork                    = 26,                            /*AFPCall command codes*/
  161.     afpRead                        = 27,                            /*AFPCall command codes*/
  162.     afpRename                    = 28,                            /*AFPCall command codes*/
  163.     afpSetDirParms                = 29                            /*AFPCall command codes*/
  164. };
  165.  
  166.  
  167. enum {
  168.     afpSetFileParms                = 30,                            /*AFPCall command codes*/
  169.     afpSetForkParms                = 31,                            /*AFPCall command codes*/
  170.     afpSetVolParms                = 32,                            /*AFPCall command codes*/
  171.     afpWrite                    = 33,                            /*AFPCall command codes*/
  172.     afpGetFlDrParms                = 34,                            /*AFPCall command codes*/
  173.     afpSetFlDrParms                = 35,                            /*AFPCall command codes*/
  174.     afpDTOpen                    = 48,                            /*AFPCall command codes*/
  175.     afpDTClose                    = 49,                            /*AFPCall command codes*/
  176.     afpGetIcon                    = 51,                            /*AFPCall command codes*/
  177.     afpGtIcnInfo                = 52,                            /*AFPCall command codes*/
  178.     afpAddAPPL                    = 53,                            /*AFPCall command codes*/
  179.     afpRmvAPPL                    = 54,                            /*AFPCall command codes*/
  180.     afpGetAPPL                    = 55,                            /*AFPCall command codes*/
  181.     afpAddCmt                    = 56,                            /*AFPCall command codes*/
  182.     afpRmvCmt                    = 57,                            /*AFPCall command codes*/
  183.     afpGetCmt                    = 58,                            /*AFPCall command codes*/
  184.     afpAddIcon                    = 192,                            /*Special code for ASP Write commands*/
  185.     xppLoadedBit                = 5,                            /* XPP bit in PortBUse */
  186.     scbMemSize                    = 192,                            /* Size of memory for SCB */
  187.     xppFlagClr                    = 0                                /* Cs for AFPCommandBlock */
  188. };
  189.  
  190.  
  191. enum {
  192.     xppFlagSet                    = 128,                            /* StartEndFlag & NewLineFlag fields. */
  193.     lapSize                        = 20,
  194.     ddpSize                        = 26,
  195.     nbpSize                        = 26,
  196.     atpSize                        = 56,
  197.     atpXOvalue                    = 32,                            /*ATP exactly-once bit */
  198.     atpEOMvalue                    = 16,                            /*ATP End-Of-Message bit */
  199.     atpSTSvalue                    = 8,                            /*ATP Send-Transmission-Status bit */
  200.     atpTIDValidvalue            = 2,                            /*ATP trans. ID valid bit */
  201.     atpSendChkvalue                = 1,                            /*ATP send checksum bit */
  202.     zipGetLocalZones            = 5,
  203.     zipGetZoneList                = 6,
  204.     zipGetMyZone                = 7,
  205.     LAPMgrPtr                    = 0x0B18,                        /*Entry point for LAP Manager*/
  206.     LAPMgrCall                    = 2,                            /*Offset to LAP routines*/
  207.     LAddAEQ                        = 23,                            /*LAPAddATQ routine selector*/
  208.     LRmvAEQ                        = 24                            /*LAPRmvATQ routine selector*/
  209. };
  210.  
  211. #define MPPioCompletion MPP.ioCompletion
  212. #define MPPioResult MPP.ioResult
  213. #define MPPioRefNum MPP.ioRefNum
  214. #define MPPcsCode MPP.csCode
  215. #define LAPprotType LAP.protType
  216. #define LAPwdsPointer LAP.u.wdsPointer
  217. #define LAPhandler LAP.u.handler
  218. #define DDPsocket DDP.socket
  219. #define DDPchecksumFlag DDP.checksumFlag
  220. #define DDPwdsPointer DDP.u.wdsPointer
  221. #define DDPlistener DDP.u.listener
  222. #define NBPinterval NBP.interval
  223. #define NBPcount NBP.count
  224. #define NBPntQElPtr NBP.nbpPtrs.ntQElPtr
  225. #define NBPentityPtr NBP.nbpPtrs.entityPtr
  226. #define NBPverifyFlag NBP.parm.verifyFlag
  227. #define NBPretBuffPtr NBP.parm.Lookup.retBuffPtr
  228. #define NBPretBuffSize NBP.parm.Lookup.retBuffSize
  229. #define NBPmaxToGet NBP.parm.Lookup.maxToGet
  230. #define NBPnumGotten NBP.parm.Lookup.numGotten
  231. #define NBPconfirmAddr NBP.parm.Confirm.confirmAddr
  232. #define NBPnKillQEl NBPKILL.nKillQEl
  233. #define NBPnewSocket NBP.parm.Confirm.newSocket
  234. #define ATPioCompletion ATP.ioCompletion
  235. #define ATPioResult ATP.ioResult
  236. #define ATPuserData ATP.userData
  237. #define ATPreqTID ATP.reqTID
  238. #define ATPioRefNum ATP.ioRefNum
  239. #define ATPcsCode ATP.csCode
  240. #define ATPatpSocket ATP.atpSocket
  241. #define ATPatpFlags ATP.atpFlags
  242. #define ATPaddrBlock ATP.addrBlock
  243. #define ATPreqLength ATP.reqLength
  244. #define ATPreqPointer ATP.reqPointer
  245. #define ATPbdsPointer ATP.bdsPointer
  246. #define ATPtimeOutVal SREQ.timeOutVal
  247. #define ATPnumOfResps SREQ.numOfResps
  248. #define ATPretryCount SREQ.retryCount
  249. #define ATPnumOfBuffs OTH1.u.numOfBuffs
  250. #define ATPbitMap OTH1.u.bitMap
  251. #define ATPrspNum OTH1.u.rspNum
  252. #define ATPbdsSize OTH2.bdsSize
  253. #define ATPtransID OTH2.transID
  254. #define ATPaKillQEl KILL.aKillQEl
  255.  
  256. enum {
  257.     tLAPRead                    = 0,
  258.     tLAPWrite                    = 1,
  259.     tDDPRead                    = 2,
  260.     tDDPWrite                    = 3,
  261.     tNBPLookup                    = 4,
  262.     tNBPConfirm                    = 5,
  263.     tNBPRegister                = 6,
  264.     tATPSndRequest                = 7,
  265.     tATPGetRequest                = 8,
  266.     tATPSdRsp                    = 9,
  267.     tATPAddRsp                    = 10,
  268.     tATPRequest                    = 11,
  269.     tATPResponse                = 12
  270. };
  271.  
  272. typedef SInt8 ABCallType;
  273.  
  274. enum {
  275.     lapProto                    = 0,
  276.     ddpProto                    = 1,
  277.     nbpProto                    = 2,
  278.     atpProto                    = 3
  279. };
  280.  
  281. typedef UInt8 ABProtoType;
  282. typedef Byte ABByte;
  283. struct LAPAdrBlock {
  284.     UInt8                             dstNodeID;
  285.     UInt8                             srcNodeID;
  286.     ABByte                             lapProtType;
  287.     UInt8                             filler;                        /*    Filler for proper byte alignment*/
  288. };
  289. typedef struct LAPAdrBlock LAPAdrBlock;
  290.  
  291. typedef struct ATQEntry ATQEntry;
  292. typedef ATQEntry *ATQEntryPtr;
  293. typedef long (*ATalkTransitionEventProcPtr)(long eventCode, ATQEntryPtr qElem, void *eventParameter);
  294.  
  295. #if GENERATINGCFM
  296. typedef UniversalProcPtr ATalkTransitionEventUPP;
  297. #else
  298. typedef ATalkTransitionEventProcPtr ATalkTransitionEventUPP;
  299. #endif
  300. typedef ATalkTransitionEventUPP ATalkTransitionEvent;
  301. struct ATQEntry {
  302.     struct ATQEntry *                qLink;                        /*next queue entry*/
  303.     short                             qType;                        /*queue type*/
  304.     ATalkTransitionEventUPP         CallAddr;                    /*your routine descriptor*/
  305. };
  306.  
  307. struct RetransType {
  308.     UInt8                             retransInterval;
  309.     UInt8                             retransCount;
  310. };
  311. typedef struct RetransType RetransType;
  312.  
  313. struct BDSElement {
  314.     short                             buffSize;
  315.     Ptr                             buffPtr;
  316.     short                             dataSize;
  317.     long                             userBytes;
  318. };
  319. typedef struct BDSElement BDSElement;
  320.  
  321. typedef BDSElement BDSType[8];
  322. typedef BDSElement *BDSPtr;
  323. typedef char BitMapType;
  324. struct ATLAPRec {
  325.     ABCallType                         abOpcode;
  326.     SInt8                             filler;                        /*    Filler for proper byte alignment*/
  327.     short                             abResult;
  328.     long                             abUserReference;
  329.     LAPAdrBlock                     lapAddress;
  330.     short                             lapReqCount;
  331.     short                             lapActCount;
  332.     Ptr                             lapDataPtr;
  333. };
  334. typedef struct ATLAPRec ATLAPRec;
  335.  
  336. typedef ATLAPRec *ATLAPRecPtr;
  337. typedef ATLAPRecPtr *ATLAPRecHandle;
  338. struct ATDDPRec {
  339.     ABCallType                         abOpcode;
  340.     SInt8                             filler;                        /*    Filler for proper byte alignment*/
  341.     short                             abResult;
  342.     long                             abUserReference;
  343.     short                             ddpType;
  344.     short                             ddpSocket;
  345.     AddrBlock                         ddpAddress;
  346.     short                             ddpReqCount;
  347.     short                             ddpActCount;
  348.     Ptr                             ddpDataPtr;
  349.     short                             ddpNodeID;
  350. };
  351. typedef struct ATDDPRec ATDDPRec;
  352.  
  353. typedef ATDDPRec *ATDDPRecPtr;
  354. typedef ATDDPRecPtr *ATDDPRecHandle;
  355. struct ATNBPRec {
  356.     ABCallType                         abOpcode;
  357.     SInt8                             filler;                        /*    Filler for proper byte alignment*/
  358.     short                             abResult;
  359.     long                             abUserReference;
  360.     EntityPtr                         nbpEntityPtr;
  361.     Ptr                             nbpBufPtr;
  362.     short                             nbpBufSize;
  363.     short                             nbpDataField;
  364.     AddrBlock                         nbpAddress;
  365.     RetransType                     nbpRetransmitInfo;
  366. };
  367. typedef struct ATNBPRec ATNBPRec;
  368.  
  369. typedef ATNBPRec *ATNBPRecPtr;
  370. typedef ATNBPRecPtr *ATNBPRecHandle;
  371. struct ATATPRec {
  372.     ABCallType                         abOpcode;
  373.     SInt8                             filler1;                    /*    Filler for proper byte alignment*/
  374.     short                             abResult;
  375.     long                             abUserReference;
  376.     short                             atpSocket;
  377.     AddrBlock                         atpAddress;
  378.     short                             atpReqCount;
  379.     Ptr                             atpDataPtr;
  380.     BDSPtr                             atpRspBDSPtr;
  381.     BitMapType                         atpBitMap;
  382.     SInt8                             filler2;                    /*    Filler for proper byte alignment*/
  383.     short                             atpTransID;
  384.     short                             atpActCount;
  385.     long                             atpUserData;
  386.     Boolean                         atpXO;
  387.     Boolean                         atpEOM;
  388.     short                             atpTimeOut;
  389.     short                             atpRetries;
  390.     short                             atpNumBufs;
  391.     short                             atpNumRsp;
  392.     short                             atpBDSSize;
  393.     long                             atpRspUData;
  394.     Ptr                             atpRspBuf;
  395.     short                             atpRspSize;
  396. };
  397. typedef struct ATATPRec ATATPRec;
  398.  
  399. typedef ATATPRec *ATATPRecPtr;
  400. typedef ATATPRecPtr *ATATPRecHandle;
  401. struct AFPCommandBlock {
  402.     UInt8                             cmdByte;
  403.     UInt8                             startEndFlag;
  404.     short                             forkRefNum;
  405.     long                             rwOffset;
  406.     long                             reqCount;
  407.     UInt8                             newLineFlag;
  408.     char                             newLineChar;
  409. };
  410. typedef struct AFPCommandBlock AFPCommandBlock;
  411.  
  412. typedef union MPPParamBlock MPPParamBlock;
  413. typedef union ATPParamBlock ATPParamBlock;
  414. typedef union XPPParamBlock XPPParamBlock;
  415. typedef MPPParamBlock *MPPPBPtr;
  416. typedef ATPParamBlock *ATPPBPtr;
  417. typedef XPPParamBlock *XPPParmBlkPtr;
  418. /*
  419.         This ProcPtr uses register based parameters on the 68k and cannot
  420.         be written in or called from a high-level language without the help of
  421.         mixed mode or assembly glue.
  422.  
  423.             typedef pascal void (*MPPCompletionProcPtr)(MPPPBPtr thePBptr);
  424.  
  425. */
  426. /*
  427.         This ProcPtr uses register based parameters on the 68k and cannot
  428.         be written in or called from a high-level language without the help of
  429.         mixed mode or assembly glue.
  430.  
  431.             typedef pascal void (*ATPCompletionProcPtr)(ATPPBPtr thePBptr);
  432.  
  433. */
  434. /*
  435.         This ProcPtr uses register based parameters on the 68k and cannot
  436.         be written in or called from a high-level language without the help of
  437.         mixed mode or assembly glue.
  438.  
  439.             typedef pascal void (*XPPCompletionProcPtr)(XPPParmBlkPtr thePBptr);
  440.  
  441. */
  442. /*
  443.         This ProcPtr uses register based parameters on the 68k and cannot
  444.         be written in or called from a high-level language without the help of
  445.         mixed mode or assembly glue.
  446.  
  447.             typedef pascal void (*AttnRoutineProcPtr)(short sessRefnum, short attnBytes);
  448.  
  449. */
  450.  
  451. #if GENERATINGCFM
  452. typedef UniversalProcPtr MPPCompletionUPP;
  453. typedef UniversalProcPtr ATPCompletionUPP;
  454. typedef UniversalProcPtr XPPCompletionUPP;
  455. typedef UniversalProcPtr AttnRoutineUPP;
  456. #else
  457. typedef Register68kProcPtr MPPCompletionUPP;
  458. typedef Register68kProcPtr ATPCompletionUPP;
  459. typedef Register68kProcPtr XPPCompletionUPP;
  460. typedef Register68kProcPtr AttnRoutineUPP;
  461. #endif
  462. struct WDSElement {
  463.     short                             entryLength;
  464.     Ptr                             entryPtr;
  465. };
  466. typedef struct WDSElement WDSElement;
  467.  
  468. struct NTElement {
  469.     AddrBlock                         nteAddress;                    /*network address of entity*/
  470.     SInt8                             filler;
  471.     SInt8                             entityData[99];                /*Object, Type & Zone*/
  472. };
  473. typedef struct NTElement NTElement;
  474.  
  475. struct NamesTableEntry {
  476.     Ptr                             qNext;                        /*ptr to next NTE*/
  477.     NTElement                         nt;
  478. };
  479. typedef struct NamesTableEntry NamesTableEntry;
  480.  
  481. /*
  482.         This ProcPtr uses register based parameters on the 68k and cannot
  483.         be written in or called from a high-level language without the help of
  484.         mixed mode or assembly glue.
  485.  
  486.             typedef pascal Boolean (*MPPProtocolHandlerProcPtr)(Ptr SCCAddr1, Ptr SCCAddr2, Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, short numBytesLeftToReadInPacket);
  487.  
  488. */
  489. /*
  490.         This ProcPtr uses register based parameters on the 68k and cannot
  491.         be written in or called from a high-level language without the help of
  492.         mixed mode or assembly glue.
  493.  
  494.             typedef pascal Boolean (*DDPSocketListenerProcPtr)(Ptr SCCAddr1, Ptr SCCAddr2, Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, UInt8 packetDestinationNumber, short numBytesLeftToReadInPacket);
  495.  
  496. */
  497.  
  498. #if GENERATINGCFM
  499. typedef UniversalProcPtr MPPProtocolHandlerUPP;
  500. typedef UniversalProcPtr DDPSocketListenerUPP;
  501. #else
  502. typedef Register68kProcPtr MPPProtocolHandlerUPP;
  503. typedef Register68kProcPtr DDPSocketListenerUPP;
  504. #endif
  505. /*
  506.     MPPProtocolHandlerProcs and  DDPSocketListenerProcs cannot be written 
  507.     in or called from a high-level language without the help of mixed mode 
  508.     or assembly glue because they use the following parameter-passing conventions:
  509.  
  510.     typedef Boolean (*MPPProtocolHandlerProcPtr)(Ptr SCCAddr1, Ptr SCCAddr2, 
  511.             Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, 
  512.             short numBytesLeftToReadInPacket);
  513.  
  514.         In:
  515.             =>    SCCAddr1                    A0.L
  516.             =>    SCCAddr2                    A1.L
  517.             =>    MPPLocalVars                A2.L
  518.             =>    nextFreeByteInRHA            A3.L
  519.             =>    ReadPacketAndReadRestPtr    A4.L
  520.             =>    numBytesLeftToReadInPacket    D1.W
  521.         Out:
  522.             <=    Boolean                        Z bit of CCR
  523.  
  524.     typedef Boolean (*DDPSocketListenerProcPtr)(Ptr SCCAddr1, Ptr SCCAddr2, 
  525.             Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, 
  526.             UInt8 packetDestinationNumber, short numBytesLeftToReadInPacket);
  527.  
  528.         In:
  529.             =>    SCCAddr1                    A0.L
  530.             =>    SCCAddr2                    A1.L
  531.             =>    MPPLocalVars                A2.L
  532.             =>    nextFreeByteInRHA            A3.L
  533.             =>    ReadPacketAndReadRestPtr    A4.L
  534.             =>    packetDestinationNumber        D0.B
  535.             =>    numBytesLeftToReadInPacket    D1.W
  536.         Out:
  537.             <=    Boolean                        Z bit of CCR
  538.  
  539. */
  540. struct MPPparms {
  541.     QElem *                            qLink;                        /*next queue entry*/
  542.     short                             qType;                        /*queue type*/
  543.     short                             ioTrap;                        /*routine trap*/
  544.     Ptr                             ioCmdAddr;                    /*routine address*/
  545.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  546.     OSErr                             ioResult;                    /*result code*/
  547.     long                             userData;                    /*Command result (ATP user bytes)*/
  548.     short                             reqTID;                        /*request transaction ID*/
  549.     short                             ioRefNum;                    /*driver reference number*/
  550.     short                             csCode;                        /*Call command code*/
  551. };
  552. typedef struct MPPparms MPPparms;
  553.  
  554. struct LAPparms {
  555.     QElem *                            qLink;                        /*next queue entry*/
  556.     short                             qType;                        /*queue type*/
  557.     short                             ioTrap;                        /*routine trap*/
  558.     Ptr                             ioCmdAddr;                    /*routine address*/
  559.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  560.     OSErr                             ioResult;                    /*result code*/
  561.     long                             userData;                    /*Command result (ATP user bytes)*/
  562.     short                             reqTID;                        /*request transaction ID*/
  563.     short                             ioRefNum;                    /*driver reference number*/
  564.     short                             csCode;                        /*Call command code*/
  565.     UInt8                             protType;                    /*ALAP protocol Type */
  566.     UInt8                             filler;
  567.     union {
  568.         Ptr                             wdsPointer;                /*-> write data structure*/
  569.         MPPProtocolHandlerUPP             handler;                /*-> protocol handler routine*/
  570.     }                                 u;
  571. };
  572. typedef struct LAPparms LAPparms;
  573.  
  574. struct DDPparms {
  575.     QElem *                            qLink;                        /*next queue entry*/
  576.     short                             qType;                        /*queue type*/
  577.     short                             ioTrap;                        /*routine trap*/
  578.     Ptr                             ioCmdAddr;                    /*routine address*/
  579.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  580.     OSErr                             ioResult;                    /*result code*/
  581.     long                             userData;                    /*Command result (ATP user bytes)*/
  582.     short                             reqTID;                        /*request transaction ID*/
  583.     short                             ioRefNum;                    /*driver reference number*/
  584.     short                             csCode;                        /*Call command code*/
  585.     UInt8                             socket;                        /*socket number */
  586.     UInt8                             checksumFlag;                /*check sum flag */
  587.     union {
  588.         Ptr                             wdsPointer;                /*-> write data structure*/
  589.         DDPSocketListenerUPP             listener;                /*->write data structure or -> Listener*/
  590.     }                                 u;
  591. };
  592. typedef struct DDPparms DDPparms;
  593.  
  594. union NBPPtrs {
  595.     Ptr                             ntQElPtr;
  596.     Ptr                             entityPtr;
  597. };
  598. typedef union NBPPtrs NBPPtrs;
  599.  
  600. union LookupConfirmParams {
  601.     UInt8                             verifyFlag;
  602.     struct {
  603.         Ptr                             retBuffPtr;
  604.         short                             retBuffSize;
  605.         short                             maxToGet;
  606.         short                             numGotten;
  607.     }                                 Lookup;
  608.     struct {
  609.         AddrBlock                         confirmAddr;
  610.         UInt8                             newSocket;
  611.         SInt8                             filler;                    /*    Filler for proper byte alignment*/
  612.     }                                 Confirm;
  613. };
  614. typedef union LookupConfirmParams LookupConfirmParams;
  615.  
  616. struct NBPparms {
  617.     QElem *                            qLink;                        /*next queue entry*/
  618.     short                             qType;                        /*queue type*/
  619.     short                             ioTrap;                        /*routine trap*/
  620.     Ptr                             ioCmdAddr;                    /*routine address*/
  621.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  622.     OSErr                             ioResult;                    /*result code*/
  623.     long                             userData;                    /*Command result (ATP user bytes)*/
  624.     short                             reqTID;                        /*request transaction ID*/
  625.     short                             ioRefNum;                    /*driver reference number*/
  626.     short                             csCode;                        /*Call command code*/
  627.     UInt8                             interval;                    /*retry interval */
  628.     UInt8                             count;                        /*retry count */
  629.     NBPPtrs                         nbpPtrs;
  630.     LookupConfirmParams             parm;
  631. };
  632. typedef struct NBPparms NBPparms;
  633.  
  634. struct SetSelfparms {
  635.     QElem *                            qLink;                        /*next queue entry*/
  636.     short                             qType;                        /*queue type*/
  637.     short                             ioTrap;                        /*routine trap*/
  638.     Ptr                             ioCmdAddr;                    /*routine address*/
  639.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  640.     OSErr                             ioResult;                    /*result code*/
  641.     long                             userData;                    /*Command result (ATP user bytes)*/
  642.     short                             reqTID;                        /*request transaction ID*/
  643.     short                             ioRefNum;                    /*driver reference number*/
  644.     short                             csCode;                        /*Call command code*/
  645.     UInt8                             newSelfFlag;                /*self-send toggle flag */
  646.     UInt8                             oldSelfFlag;                /*previous self-send state */
  647. };
  648. typedef struct SetSelfparms SetSelfparms;
  649.  
  650. struct NBPKillparms {
  651.     QElem *                            qLink;                        /*next queue entry*/
  652.     short                             qType;                        /*queue type*/
  653.     short                             ioTrap;                        /*routine trap*/
  654.     Ptr                             ioCmdAddr;                    /*routine address*/
  655.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  656.     OSErr                             ioResult;                    /*result code*/
  657.     long                             userData;                    /*Command result (ATP user bytes)*/
  658.     short                             reqTID;                        /*request transaction ID*/
  659.     short                             ioRefNum;                    /*driver reference number*/
  660.     short                             csCode;                        /*Call command code*/
  661.     Ptr                             nKillQEl;                    /*ptr to i/o queue element to cancel */
  662. };
  663. typedef struct NBPKillparms NBPKillparms;
  664.  
  665. struct GetAppleTalkInfoParm {
  666.     QElem *                            qLink;                        /*next queue entry*/
  667.     short                             qType;                        /*queue type*/
  668.     short                             ioTrap;                        /*routine trap*/
  669.     Ptr                             ioCmdAddr;                    /*routine address*/
  670.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  671.     OSErr                             ioResult;                    /*result code*/
  672.     long                             userData;                    /*Command result (ATP user bytes)*/
  673.     short                             reqTID;                        /*request transaction ID*/
  674.     short                             ioRefNum;                    /*driver reference number*/
  675.     short                             csCode;                        /*Call command code*/
  676.                                                                 /*max. concurrent NBP requests*/
  677.     short                             version;                    /*requested info version*/
  678.     Ptr                             varsPtr;                    /*pointer to well known MPP vars*/
  679.     Ptr                             DCEPtr;                        /*pointer to MPP DCE*/
  680.     short                             portID;                        /*port number [0..7]*/
  681.     long                             configuration;                /*32-bit configuration word*/
  682.     short                             selfSend;                    /*non zero if SelfSend enabled*/
  683.     short                             netLo;                        /*low value of network range*/
  684.     short                             netHi;                        /*high value of network range*/
  685.     long                             ourAdd;                        /*our 24-bit AppleTalk address*/
  686.     long                             routerAddr;                    /*24-bit address of (last) router*/
  687.     short                             numOfPHs;                    /*max. number of protocol handlers*/
  688.     short                             numOfSkts;                    /*max. number of static sockets*/
  689.     short                             numNBPEs;                    /*max. concurrent NBP requests*/
  690.     Ptr                             nTQueue;                    /*pointer to registered name queue*/
  691.     short                             LAlength;                    /*length in bytes of data link addr*/
  692.     Ptr                             linkAddr;                    /*data link address returned*/
  693.     Ptr                             zoneName;                    /*zone name returned*/
  694. };
  695. typedef struct GetAppleTalkInfoParm GetAppleTalkInfoParm;
  696.  
  697. struct ATalkClosePrepParm {
  698.     QElem *                            qLink;                        /*next queue entry*/
  699.     short                             qType;                        /*queue type*/
  700.     short                             ioTrap;                        /*routine trap*/
  701.     Ptr                             ioCmdAddr;                    /*routine address*/
  702.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  703.     OSErr                             ioResult;                    /*result code*/
  704.     long                             userData;                    /*Command result (ATP user bytes)*/
  705.     short                             reqTID;                        /*request transaction ID*/
  706.     short                             ioRefNum;                    /*driver reference number*/
  707.     short                             csCode;                        /*Call command code*/
  708.     Ptr                             appName;                    /*pointer to application name in buffer*/
  709. };
  710. typedef struct ATalkClosePrepParm ATalkClosePrepParm;
  711.  
  712. union MPPParamBlock {
  713.     MPPparms                         MPP;                        /*General MPP parms*/
  714.     LAPparms                         LAP;                        /*ALAP calls*/
  715.     DDPparms                         DDP;                        /*DDP calls*/
  716.     NBPparms                         NBP;                        /*NBP calls*/
  717.     SetSelfparms                     SETSELF;
  718.     NBPKillparms                     NBPKILL;
  719.     GetAppleTalkInfoParm             GAIINFO;
  720.     ATalkClosePrepParm                 ATALKCLOSE;
  721. };
  722.  
  723. struct XPPPrmBlk {
  724.     QElem *                            qLink;
  725.     short                             qType;
  726.     short                             ioTrap;
  727.     Ptr                             ioCmdAddr;
  728.     XPPCompletionUPP                 ioCompletion;
  729.     OSErr                             ioResult;
  730.     long                             cmdResult;
  731.     short                             ioVRefNum;
  732.     short                             ioRefNum;
  733.     short                             csCode;
  734.     short                             sessRefnum;                    /*Offset to session refnum */
  735.     UInt8                             aspTimeout;                    /*Timeout for ATP */
  736.     UInt8                             aspRetry;                    /*Retry count for ATP */
  737.     short                             cbSize;                        /*Command block size */
  738.     Ptr                             cbPtr;                        /*Command block pointer */
  739.     short                             rbSize;                        /*Reply buffer size */
  740.     Ptr                             rbPtr;                        /*Reply buffer pointer */
  741.     short                             wdSize;                        /*Write Data size*/
  742.     Ptr                             wdPtr;                        /*Write Data pointer*/
  743.     UInt8                             ccbStart[296];                /*CCB memory allocated for driver afpWrite max size(CCB)=296 all other calls=150*/
  744. };
  745. typedef struct XPPPrmBlk XPPPrmBlk;
  746.  
  747. struct ASPGetparmsBlk {
  748.     QElem *                            qLink;
  749.     short                             qType;
  750.     short                             ioTrap;
  751.     Ptr                             ioCmdAddr;
  752.     XPPCompletionUPP                 ioCompletion;
  753.     OSErr                             ioResult;
  754.     long                             cmdResult;
  755.     short                             ioVRefNum;
  756.     short                             ioRefNum;
  757.     short                             csCode;
  758.     short                             aspMaxCmdSize;                /*For SPGetParms*/
  759.     short                             aspQuantumSize;
  760.     short                             numSesss;
  761. };
  762. typedef struct ASPGetparmsBlk ASPGetparmsBlk;
  763.  
  764. struct ASPAbortPrm {
  765.     QElem *                            qLink;
  766.     short                             qType;
  767.     short                             ioTrap;
  768.     Ptr                             ioCmdAddr;
  769.     XPPCompletionUPP                 ioCompletion;
  770.     OSErr                             ioResult;
  771.     long                             cmdResult;
  772.     short                             ioVRefNum;
  773.     short                             ioRefNum;
  774.     short                             csCode;
  775.     Ptr                             abortSCBPtr;                /*SCB pointer for AbortOS */
  776. };
  777. typedef struct ASPAbortPrm ASPAbortPrm;
  778.  
  779. struct ASPOpenPrm {
  780.     QElem *                            qLink;
  781.     short                             qType;
  782.     short                             ioTrap;
  783.     Ptr                             ioCmdAddr;
  784.     XPPCompletionUPP                 ioCompletion;
  785.     OSErr                             ioResult;
  786.     long                             cmdResult;
  787.     short                             ioVRefNum;
  788.     short                             ioRefNum;
  789.     short                             csCode;
  790.     short                             sessRefnum;                    /*Offset to session refnum */
  791.     UInt8                             aspTimeout;                    /*Timeout for ATP */
  792.     UInt8                             aspRetry;                    /*Retry count for ATP */
  793.     AddrBlock                         serverAddr;                    /*Server address block */
  794.     Ptr                             scbPointer;                    /*SCB pointer */
  795.     AttnRoutineUPP                     attnRoutine;                /*Attention routine pointer*/
  796. };
  797. typedef struct ASPOpenPrm ASPOpenPrm;
  798.  
  799. typedef ASPOpenPrm *ASPOpenPrmPtr;
  800. struct AFPLoginPrm {
  801.     QElem *                            qLink;
  802.     short                             qType;
  803.     short                             ioTrap;
  804.     Ptr                             ioCmdAddr;
  805.     XPPCompletionUPP                 ioCompletion;
  806.     OSErr                             ioResult;
  807.     long                             cmdResult;
  808.     short                             ioVRefNum;
  809.     short                             ioRefNum;
  810.     short                             csCode;
  811.     short                             sessRefnum;                    /*Offset to session refnum */
  812.     UInt8                             aspTimeout;                    /*Timeout for ATP */
  813.     UInt8                             aspRetry;                    /*Retry count for ATP */
  814.     short                             cbSize;                        /*Command block size */
  815.     Ptr                             cbPtr;                        /*Command block pointer */
  816.     short                             rbSize;                        /*Reply buffer size */
  817.     Ptr                             rbPtr;                        /*Reply buffer pointer */
  818.     AddrBlock                         afpAddrBlock;                /*block in AFP login */
  819.     Ptr                             afpSCBPtr;                    /*SCB pointer in AFP login */
  820.     Ptr                             afpAttnRoutine;                /*routine pointer in AFP login */
  821.     UInt8                             ccbFill[144];                /*CCB memory allocated for driver  Login needs only 150 bytes BUT CCB really starts in the middle of AFPSCBPtr and also clobbers AFPAttnRoutine. */
  822. };
  823. typedef struct AFPLoginPrm AFPLoginPrm;
  824.  
  825. struct XCallParam {
  826.     QElem *                            qLink;
  827.     short                             qType;
  828.     short                             ioTrap;
  829.     Ptr                             ioCmdAddr;
  830.     XPPCompletionUPP                 ioCompletion;
  831.     OSErr                             ioResult;
  832.     long                             cmdResult;
  833.     short                             ioVRefNum;
  834.     short                             ioRefNum;
  835.     short                             csCode;
  836.     short                             xppSubCode;
  837.     UInt8                             xppTimeout;                    /*retry interval (seconds)*/
  838.     UInt8                             xppRetry;                    /*retry count*/
  839.     short                             filler1;
  840.     Ptr                             zipBuffPtr;                    /*pointer to buffer (must be 578 bytes)*/
  841.     short                             zipNumZones;                /*no. of zone names in this response*/
  842.     UInt8                             zipLastFlag;                /*non-zero if no more zones*/
  843.     UInt8                             filler2;                    /*filler*/
  844.     UInt8                             zipInfoField[70];            /*on initial call, set first word to zero*/
  845. };
  846. typedef struct XCallParam XCallParam;
  847.  
  848. union XPPParamBlock {
  849.     XPPPrmBlk                         XPP;
  850.     ASPGetparmsBlk                     GETPARM;
  851.     ASPAbortPrm                     ABORT;
  852.     ASPOpenPrm                         OPEN;
  853.     AFPLoginPrm                     LOGIN;
  854.     XCallParam                         XCALL;
  855. };
  856.  
  857. struct ATPparms {
  858.     QElem *                            qLink;                        /*next queue entry*/
  859.     short                             qType;                        /*queue type*/
  860.     short                             ioTrap;                        /*routine trap*/
  861.     Ptr                             ioCmdAddr;                    /*routine address*/
  862.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  863.     OSErr                             ioResult;                    /*result code*/
  864.     long                             userData;                    /*Command result (ATP user bytes)*/
  865.     short                             reqTID;                        /*request transaction ID*/
  866.     short                             ioRefNum;                    /*driver reference number*/
  867.     short                             csCode;                        /*Call command code*/
  868.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  869.     UInt8                             atpFlags;                    /*control information*/
  870.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  871.     short                             reqLength;                    /*request/response length*/
  872.     Ptr                             reqPointer;                    /*->request/response Data*/
  873.     Ptr                             bdsPointer;                    /*->response BDS */
  874. };
  875. typedef struct ATPparms ATPparms;
  876.  
  877. struct SendReqparms {
  878.     QElem *                            qLink;                        /*next queue entry*/
  879.     short                             qType;                        /*queue type*/
  880.     short                             ioTrap;                        /*routine trap*/
  881.     Ptr                             ioCmdAddr;                    /*routine address*/
  882.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  883.     OSErr                             ioResult;                    /*result code*/
  884.     long                             userData;                    /*Command result (ATP user bytes)*/
  885.     short                             reqTID;                        /*request transaction ID*/
  886.     short                             ioRefNum;                    /*driver reference number*/
  887.     short                             csCode;                        /*Call command code*/
  888.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  889.     UInt8                             atpFlags;                    /*control information*/
  890.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  891.     short                             reqLength;                    /*request/response length*/
  892.     Ptr                             reqPointer;                    /*->request/response Data*/
  893.     Ptr                             bdsPointer;                    /*->response BDS */
  894.     UInt8                             numOfBuffs;                    /*numOfBuffs */
  895.     UInt8                             timeOutVal;                    /*timeout interval */
  896.     UInt8                             numOfResps;                    /*number of responses actually received */
  897.     UInt8                             retryCount;                    /*number of retries */
  898.     short                             intBuff;                    /*used internally for NSendRequest */
  899.     UInt8                             TRelTime;                    /*TRelease time for extended send request */
  900.     SInt8                             filler0;
  901. };
  902. typedef struct SendReqparms SendReqparms;
  903.  
  904. struct ATPmisc1 {
  905.     QElem *                            qLink;                        /*next queue entry*/
  906.     short                             qType;                        /*queue type*/
  907.     short                             ioTrap;                        /*routine trap*/
  908.     Ptr                             ioCmdAddr;                    /*routine address*/
  909.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  910.     OSErr                             ioResult;                    /*result code*/
  911.     long                             userData;                    /*Command result (ATP user bytes)*/
  912.     short                             reqTID;                        /*request transaction ID*/
  913.     short                             ioRefNum;                    /*driver reference number*/
  914.     short                             csCode;                        /*Call command code*/
  915.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  916.     UInt8                             atpFlags;                    /*control information*/
  917.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  918.     short                             reqLength;                    /*request/response length*/
  919.     Ptr                             reqPointer;                    /*->request/response Data*/
  920.     Ptr                             bdsPointer;                    /*->response BDS */
  921.     union {
  922.         UInt8                             bitMap;                    /*bitmap received */
  923.         UInt8                             numOfBuffs;                /*number of responses being sent*/
  924.         UInt8                             rspNum;                    /*sequence number*/
  925.     }                                 u;
  926. };
  927. typedef struct ATPmisc1 ATPmisc1;
  928.  
  929. struct ATPmisc2 {
  930.     QElem *                            qLink;                        /*next queue entry*/
  931.     short                             qType;                        /*queue type*/
  932.     short                             ioTrap;                        /*routine trap*/
  933.     Ptr                             ioCmdAddr;                    /*routine address*/
  934.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  935.     OSErr                             ioResult;                    /*result code*/
  936.     long                             userData;                    /*Command result (ATP user bytes)*/
  937.     short                             reqTID;                        /*request transaction ID*/
  938.     short                             ioRefNum;                    /*driver reference number*/
  939.     short                             csCode;                        /*Call command code*/
  940.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  941.     UInt8                             atpFlags;                    /*control information*/
  942.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  943.     short                             reqLength;                    /*request/response length*/
  944.     Ptr                             reqPointer;                    /*->request/response Data*/
  945.     Ptr                             bdsPointer;                    /*->response BDS */
  946.     UInt8                             filler;
  947.     UInt8                             bdsSize;                    /*number of BDS elements */
  948.     short                             transID;                    /*transaction ID recd. */
  949. };
  950. typedef struct ATPmisc2 ATPmisc2;
  951.  
  952. struct Killparms {
  953.     QElem *                            qLink;                        /*next queue entry*/
  954.     short                             qType;                        /*queue type*/
  955.     short                             ioTrap;                        /*routine trap*/
  956.     Ptr                             ioCmdAddr;                    /*routine address*/
  957.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  958.     OSErr                             ioResult;                    /*result code*/
  959.     long                             userData;                    /*Command result (ATP user bytes)*/
  960.     short                             reqTID;                        /*request transaction ID*/
  961.     short                             ioRefNum;                    /*driver reference number*/
  962.     short                             csCode;                        /*Call command code*/
  963.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  964.     UInt8                             atpFlags;                    /*control information*/
  965.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  966.     short                             reqLength;                    /*request/response length*/
  967.     Ptr                             reqPointer;                    /*->request/response Data*/
  968.     Ptr                             bdsPointer;                    /*->response BDS */
  969.     Ptr                             aKillQEl;                    /*ptr to i/o queue element to cancel*/
  970. };
  971. typedef struct Killparms Killparms;
  972.  
  973. union ATPParamBlock {
  974.     ATPparms                         ATP;                        /*General ATP parms*/
  975.     SendReqparms                     SREQ;                        /*sendrequest parms*/
  976.     ATPmisc1                         OTH1;                        /*and a few others*/
  977.     ATPmisc2                         OTH2;                        /*and a few others*/
  978.     Killparms                         KILL;                        /*and a few others*/
  979. };
  980.  
  981.  
  982. #if GENERATINGCFM
  983. #else
  984. #endif
  985.  
  986. enum {
  987.     uppATalkTransitionEventProcInfo = kCStackBased
  988.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  989.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  990.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(ATQEntryPtr)))
  991.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))),
  992.     uppMPPCompletionProcInfo = kRegisterBased
  993.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(MPPPBPtr))),
  994.     uppATPCompletionProcInfo = kRegisterBased
  995.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(ATPPBPtr))),
  996.     uppXPPCompletionProcInfo = kRegisterBased
  997.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(XPPParmBlkPtr))),
  998.     uppAttnRoutineProcInfo = kRegisterBased
  999.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterD0, SIZE_CODE(sizeof(short)))
  1000.          | REGISTER_ROUTINE_PARAMETER(2, kRegisterD1, SIZE_CODE(sizeof(short))),
  1001.     uppMPPProtocolHandlerProcInfo = SPECIAL_CASE_PROCINFO(7),
  1002.     uppDDPSocketListenerProcInfo = SPECIAL_CASE_PROCINFO(8)
  1003. };
  1004.  
  1005. #if GENERATINGCFM
  1006. #define NewATalkTransitionEventProc(userRoutine)        \
  1007.         (ATalkTransitionEventUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppATalkTransitionEventProcInfo, GetCurrentArchitecture())
  1008. #define NewMPPCompletionProc(userRoutine)        \
  1009.         (MPPCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMPPCompletionProcInfo, GetCurrentArchitecture())
  1010. #define NewATPCompletionProc(userRoutine)        \
  1011.         (ATPCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppATPCompletionProcInfo, GetCurrentArchitecture())
  1012. #define NewXPPCompletionProc(userRoutine)        \
  1013.         (XPPCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppXPPCompletionProcInfo, GetCurrentArchitecture())
  1014. #define NewAttnRoutineProc(userRoutine)        \
  1015.         (AttnRoutineUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAttnRoutineProcInfo, GetCurrentArchitecture())
  1016. #define NewMPPProtocolHandlerProc(userRoutine)        \
  1017.         (MPPProtocolHandlerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMPPProtocolHandlerProcInfo, GetCurrentArchitecture())
  1018. #define NewDDPSocketListenerProc(userRoutine)        \
  1019.         (DDPSocketListenerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDDPSocketListenerProcInfo, GetCurrentArchitecture())
  1020. #else
  1021. #define NewATalkTransitionEventProc(userRoutine)        \
  1022.         ((ATalkTransitionEventUPP) (userRoutine))
  1023. #define NewMPPCompletionProc(userRoutine)        \
  1024.         ((MPPCompletionUPP) (userRoutine))
  1025. #define NewATPCompletionProc(userRoutine)        \
  1026.         ((ATPCompletionUPP) (userRoutine))
  1027. #define NewXPPCompletionProc(userRoutine)        \
  1028.         ((XPPCompletionUPP) (userRoutine))
  1029. #define NewAttnRoutineProc(userRoutine)        \
  1030.         ((AttnRoutineUPP) (userRoutine))
  1031. #define NewMPPProtocolHandlerProc(userRoutine)        \
  1032.         ((MPPProtocolHandlerUPP) (userRoutine))
  1033. #define NewDDPSocketListenerProc(userRoutine)        \
  1034.         ((DDPSocketListenerUPP) (userRoutine))
  1035. #endif
  1036.  
  1037. #if GENERATINGCFM
  1038. #define CallATalkTransitionEventProc(userRoutine, eventCode, qElem, eventParameter)        \
  1039.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppATalkTransitionEventProcInfo, (eventCode), (qElem), (eventParameter))
  1040. #define CallMPPCompletionProc(userRoutine, thePBptr)        \
  1041.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMPPCompletionProcInfo, (thePBptr))
  1042. #define CallATPCompletionProc(userRoutine, thePBptr)        \
  1043.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppATPCompletionProcInfo, (thePBptr))
  1044. #define CallXPPCompletionProc(userRoutine, thePBptr)        \
  1045.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppXPPCompletionProcInfo, (thePBptr))
  1046. #define CallAttnRoutineProc(userRoutine, sessRefnum, attnBytes)        \
  1047.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAttnRoutineProcInfo, (sessRefnum), (attnBytes))
  1048. #define CallMPPProtocolHandlerProc(userRoutine, SCCAddr1, SCCAddr2, MPPLocalVars, nextFreeByteInRHA, ReadPacketAndReadRestPtr, numBytesLeftToReadInPacket)        \
  1049.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMPPProtocolHandlerProcInfo, (SCCAddr1), (SCCAddr2), (MPPLocalVars), (nextFreeByteInRHA), (ReadPacketAndReadRestPtr), (numBytesLeftToReadInPacket))
  1050. #define CallDDPSocketListenerProc(userRoutine, SCCAddr1, SCCAddr2, MPPLocalVars, nextFreeByteInRHA, ReadPacketAndReadRestPtr, packetDestinationNumber, numBytesLeftToReadInPacket)        \
  1051.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppDDPSocketListenerProcInfo, (SCCAddr1), (SCCAddr2), (MPPLocalVars), (nextFreeByteInRHA), (ReadPacketAndReadRestPtr), (packetDestinationNumber), (numBytesLeftToReadInPacket))
  1052. #else
  1053. #define CallATalkTransitionEventProc(userRoutine, eventCode, qElem, eventParameter)        \
  1054.         (*(userRoutine))((eventCode), (qElem), (eventParameter))
  1055. /* (*MPPCompletionUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  1056. /* (*ATPCompletionUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  1057. /* (*XPPCompletionUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  1058. /* (*AttnRoutineUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  1059. /* (*MPPProtocolHandlerUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  1060. /* (*DDPSocketListenerUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  1061. #endif
  1062. extern pascal OSErr OpenXPP(short *xppRefnum);
  1063.  
  1064. extern pascal OSErr ASPOpenSession(XPPParmBlkPtr thePBptr, Boolean async);
  1065.  
  1066. extern pascal OSErr ASPCloseSession(XPPParmBlkPtr thePBptr, Boolean async);
  1067.  
  1068. extern pascal OSErr ASPAbortOS(XPPParmBlkPtr thePBptr, Boolean async);
  1069.  
  1070. extern pascal OSErr ASPGetParms(XPPParmBlkPtr thePBptr, Boolean async);
  1071.  
  1072. extern pascal OSErr ASPCloseAll(XPPParmBlkPtr thePBptr, Boolean async);
  1073.  
  1074. extern pascal OSErr ASPUserWrite(XPPParmBlkPtr thePBptr, Boolean async);
  1075.  
  1076. extern pascal OSErr ASPUserCommand(XPPParmBlkPtr thePBptr, Boolean async);
  1077.  
  1078. extern pascal OSErr ASPGetStatus(XPPParmBlkPtr thePBptr, Boolean async);
  1079.  
  1080. #define ASPGetStatusSync(paramBlock) ASPGetStatus((paramBlock), FALSE)
  1081. extern pascal OSErr AFPCommand(XPPParmBlkPtr thePBptr, Boolean async);
  1082.  
  1083. extern pascal OSErr GetLocalZones(XPPParmBlkPtr thePBptr, Boolean async);
  1084.  
  1085. extern pascal OSErr GetZoneList(XPPParmBlkPtr thePBptr, Boolean async);
  1086.  
  1087. extern pascal OSErr GetMyZone(XPPParmBlkPtr thePBptr, Boolean async);
  1088.  
  1089. extern pascal OSErr PAttachPH(MPPPBPtr thePBptr, Boolean async);
  1090.  
  1091. extern pascal OSErr PDetachPH(MPPPBPtr thePBptr, Boolean async);
  1092.  
  1093. extern pascal OSErr PWriteLAP(MPPPBPtr thePBptr, Boolean async);
  1094.  
  1095. extern pascal OSErr POpenSkt(MPPPBPtr thePBptr, Boolean async);
  1096.  
  1097. extern pascal OSErr PCloseSkt(MPPPBPtr thePBptr, Boolean async);
  1098.  
  1099. extern pascal OSErr PWriteDDP(MPPPBPtr thePBptr, Boolean async);
  1100.  
  1101. extern pascal OSErr PRegisterName(MPPPBPtr thePBptr, Boolean async);
  1102.  
  1103. extern pascal OSErr PLookupName(MPPPBPtr thePBptr, Boolean async);
  1104.  
  1105. #define PLookupNameSync(paramBlock) PLookupName((paramBlock), FALSE)
  1106. extern pascal OSErr PConfirmName(MPPPBPtr thePBptr, Boolean async);
  1107.  
  1108. extern pascal OSErr PRemoveName(MPPPBPtr thePBptr, Boolean async);
  1109.  
  1110. extern pascal OSErr PSetSelfSend(MPPPBPtr thePBptr, Boolean async);
  1111.  
  1112. extern pascal OSErr PKillNBP(MPPPBPtr thePBptr, Boolean async);
  1113.  
  1114. extern pascal OSErr PGetAppleTalkInfo(MPPPBPtr thePBptr, Boolean async);
  1115.  
  1116. extern pascal OSErr PATalkClosePrep(MPPPBPtr thePBptr, Boolean async);
  1117.  
  1118. extern pascal OSErr POpenATPSkt(ATPPBPtr thePBptr, Boolean async);
  1119.  
  1120. extern pascal OSErr PCloseATPSkt(ATPPBPtr thePBPtr, Boolean async);
  1121.  
  1122. extern pascal OSErr PSendRequest(ATPPBPtr thePBPtr, Boolean async);
  1123.  
  1124. extern pascal OSErr PGetRequest(ATPPBPtr thePBPtr, Boolean async);
  1125.  
  1126. extern pascal OSErr PSendResponse(ATPPBPtr thePBPtr, Boolean async);
  1127.  
  1128. extern pascal OSErr PAddResponse(ATPPBPtr thePBPtr, Boolean async);
  1129.  
  1130. extern pascal OSErr PRelTCB(ATPPBPtr thePBPtr, Boolean async);
  1131.  
  1132. extern pascal OSErr PRelRspCB(ATPPBPtr thePBPtr, Boolean async);
  1133.  
  1134. extern pascal OSErr PNSendRequest(ATPPBPtr thePBPtr, Boolean async);
  1135.  
  1136. extern pascal OSErr PKillSendReq(ATPPBPtr thePBPtr, Boolean async);
  1137.  
  1138. extern pascal OSErr PKillGetReq(ATPPBPtr thePBPtr, Boolean async);
  1139.  
  1140. extern pascal OSErr ATPKillAllGetReq(ATPPBPtr thePBPtr, Boolean async);
  1141.  
  1142. extern pascal void BuildLAPwds(Ptr wdsPtr, Ptr dataPtr, short destHost, short prototype, short frameLen);
  1143.  
  1144. extern pascal void BuildDDPwds(Ptr wdsPtr, Ptr headerPtr, Ptr dataPtr, AddrBlock netAddr, short ddpType, short dataLen);
  1145.  
  1146. extern pascal void NBPSetEntity(Ptr buffer, ConstStr32Param nbpObject, ConstStr32Param nbpType, ConstStr32Param nbpZone);
  1147.  
  1148. extern pascal void NBPSetNTE(Ptr ntePtr, ConstStr32Param nbpObject, ConstStr32Param nbpType, ConstStr32Param nbpZone, short socket);
  1149.  
  1150. extern pascal short GetBridgeAddress(void );
  1151.  
  1152. extern pascal short BuildBDS(Ptr buffPtr, Ptr bdsPtr, short buffSize);
  1153.  
  1154. extern pascal OSErr MPPOpen(void );
  1155.  
  1156. extern pascal OSErr LAPAddATQ(ATQEntryPtr theATQEntry);
  1157.  
  1158. extern pascal OSErr LAPRmvATQ(ATQEntryPtr theATQEntry);
  1159.  
  1160. extern pascal OSErr ATPLoad(void );
  1161.  
  1162. extern pascal OSErr ATPUnload(void );
  1163.  
  1164. extern pascal OSErr NBPExtract(Ptr theBuffer, short numInBuf, short whichOne, EntityName *abEntity, AddrBlock *address);
  1165.  
  1166. extern pascal OSErr GetNodeAddress(short *myNode, short *myNet);
  1167.  
  1168. extern pascal Boolean IsMPPOpen(void );
  1169.  
  1170. extern pascal Boolean IsATPOpen(void );
  1171.  
  1172. extern pascal void ATEvent(long event, Ptr infoPtr);
  1173.  
  1174. extern pascal OSErr ATPreFlightEvent(long event, long cancel, Ptr infoPtr);
  1175.  
  1176. /*
  1177.     The following routines are obsolete and will not be supported on
  1178.     PowerPC. Equivalent functionality is provided by the routines
  1179.     above.
  1180. */
  1181. #if OLDROUTINENAMES && !GENERATINGCFM
  1182. extern pascal OSErr MPPClose(void );
  1183.  
  1184. extern pascal OSErr LAPOpenProtocol(ABByte theLAPType, Ptr protoPtr);
  1185.  
  1186. extern pascal OSErr LAPCloseProtocol(ABByte theLAPType);
  1187.  
  1188. extern pascal OSErr LAPWrite(ATLAPRecHandle abRecord, Boolean async);
  1189.  
  1190. extern pascal OSErr LAPRead(ATLAPRecHandle abRecord, Boolean async);
  1191.  
  1192. extern pascal OSErr LAPRdCancel(ATLAPRecHandle abRecord);
  1193.  
  1194. extern pascal OSErr DDPOpenSocket(short *theSocket, Ptr sktListener);
  1195.  
  1196. extern pascal OSErr DDPCloseSocket(short theSocket);
  1197.  
  1198. extern pascal OSErr DDPRead(ATDDPRecHandle abRecord, Boolean retCksumErrs, Boolean async);
  1199.  
  1200. extern pascal OSErr DDPWrite(ATDDPRecHandle abRecord, Boolean doChecksum, Boolean async);
  1201.  
  1202. extern pascal OSErr DDPRdCancel(ATDDPRecHandle abRecord);
  1203.  
  1204. extern pascal OSErr ATPOpenSocket(AddrBlock addrRcvd, short *atpSocket);
  1205.  
  1206. extern pascal OSErr ATPCloseSocket(short atpSocket);
  1207.  
  1208. extern pascal OSErr ATPSndRequest(ATATPRecHandle abRecord, Boolean async);
  1209.  
  1210. extern pascal OSErr ATPRequest(ATATPRecHandle abRecord, Boolean async);
  1211.  
  1212. extern pascal OSErr ATPReqCancel(ATATPRecHandle abRecord, Boolean async);
  1213.  
  1214. extern pascal OSErr ATPGetRequest(ATATPRecHandle abRecord, Boolean async);
  1215.  
  1216. extern pascal OSErr ATPSndRsp(ATATPRecHandle abRecord, Boolean async);
  1217.  
  1218. extern pascal OSErr ATPAddRsp(ATATPRecHandle abRecord);
  1219.  
  1220. extern pascal OSErr ATPResponse(ATATPRecHandle abRecord, Boolean async);
  1221.  
  1222. extern pascal OSErr ATPRspCancel(ATATPRecHandle abRecord, Boolean async);
  1223.  
  1224. extern pascal OSErr NBPRegister(ATNBPRecHandle abRecord, Boolean async);
  1225.  
  1226. extern pascal OSErr NBPLookup(ATNBPRecHandle abRecord, Boolean async);
  1227.  
  1228. extern pascal OSErr NBPConfirm(ATNBPRecHandle abRecord, Boolean async);
  1229.  
  1230. extern pascal OSErr NBPRemove(EntityPtr abEntity);
  1231.  
  1232. extern pascal OSErr NBPLoad(void );
  1233.  
  1234. extern pascal OSErr NBPUnload(void );
  1235.  
  1236. #endif
  1237. #endif
  1238.  
  1239. #if PRAGMA_ALIGN_SUPPORTED
  1240. #pragma options align=reset
  1241. #endif
  1242.  
  1243. #if PRAGMA_IMPORT_SUPPORTED
  1244. #pragma import off
  1245. #endif
  1246.  
  1247. #ifdef __cplusplus
  1248. }
  1249. #endif
  1250.  
  1251. #endif /* __APPLETALK__ */
  1252.  
  1253.